//<script type='text/javascript'>

win.asset._proto_	= {
	blank	: function( string, ext ) {

		this.insert( div = new Element("div", { id: this.id + ".blank", class:"blank" }).update( string ));
		div.observe( "click", this.add.bind( this, ext ));
		
		if( this.vars.uptype ) this.up_prep( div );
		
		return div;
	},
	
	up_prep	: function( trg ) {

		if( this.vars.uptype == "media" ) {
			
			parenttype = ( this.vars.parenttype )? engine.type[ this.vars.parenttype ].ID : 0;
			
			Object.extend( loadcluster.init, {
				button_placeholder_id: trg.id,
				post_params : { account :init.account, auth:init.uid, objtype : engine.type[ this.vars.type ].ID, parenttype:parenttype , parentid: ( this.vars.id )? this.vars.id : 0 },
				custom_settings : { float_target : this.id + ".box", objtype : engine.type[ this.vars.type ].ID }
			} );
			
			this.up_exec.delay( 0.2, loadcluster.init );
		}
		
		if( this.vars.uptype == "advert" ) {
			
			parenttype = ( this.vars.parenttype )? engine.type[ this.vars.parenttype ].ID : 0;
			
			Object.extend( loadclusteradvert.init, {
				button_placeholder_id: trg.id,
				post_params : { account :init.account, auth:init.uid, objtype : engine.type[ this.vars.type ].ID, parenttype:parenttype , parentid: ( this.vars.id )? this.vars.id : 0 },
				custom_settings : { float_target : this.id + ".box", objtype : engine.type[ this.vars.type ].ID }
			} );
			
			this.up_exec.delay( 0.2, loadclusteradvert.init );
		}
		
		if( this.vars.uptype == "file" ) {
			
			parenttype = ( this.vars.parenttype )? engine.type[ this.vars.parenttype ].ID : 0;
			
			Object.extend( loadclusterfiles.init, {
				button_placeholder_id: trg.id,
				post_params : { account :init.account, auth:init.uid, objtype : engine.type[ this.vars.type ].ID, parenttype:parenttype , parentid: ( this.vars.id )? this.vars.id : 0 },
				custom_settings : { float_target : this.id + ".box", objtype : engine.type[ this.vars.type ].ID }
			} );
			
			this.up_exec.delay( 0.2, loadclusterfiles.init );
		}
	},
	
	up_exec	: function( obj ) {
		
		var swfu = new SWFUpload( obj );
	},
	
    plus	: function( ) {
        
        console.log(this)
        
        return true;
        
        obj = this.list[tr.ancestors()[2].id];
        obj.vars.id = tr.id.split("."); obj.vars.id= obj.vars.id[1];
        $('column_right').insert(win.asset.el('asset.obj.'+obj.vars.type+'.'+obj.vars.id, obj.tool, 'edit', obj.vars), {position:'after'});
    },
    
    add		: function( ext ) {
		
		if( ext ) dashboard.showhide();
		$('column_right').insert( new Win().request({ type: this.vars.type, action:'new', vars:this.vars, parent:( ext )? 0 : this.id }));
    },
    
    /*add_ext		: function( ext ) {
    	
    	set = Object.toJSON({ trg: this.id, type: this.vars.type, transfer_type: "push", action:"ext_new", vars:this.vars, parent:this.id });
    	new Ajax.Request( 'control.call.php', { parameters:{ set:set }, onSuccess: this.catch_ext.bind( this )});


    	
		//engine.ext.editspan.insert( new Win().request({ type: this.vars.type, action:'new', vars:this.vars, parent:this.id }));
    },*/
    
	kill	: function(element,tr) {
		delete this.list[tr.ancestors()[2].id];
		vars = win.float.list[tr.id];
		xhttp.send('ajx/mod.php', {trg:tr.ancestors()[2].id+".comment", wtype:'push', tool:vars.tool, action:"kill", 'vars':vars});
		tr.remove();
    },
      
	request	: function( flow ) {
		
		/// CLEAN UP
		
		if( typeof flow == "string" ) {
		
			xhttp.send( 'control.call.php', { trg: this.id, type: this.vars.type, transfer_type: "push", action: flow, vars: this.vars } );
		} else {
		
			if( flow ) Object.extend( this.vars.flow, flow );
			xhttp.send( 'control.call.php', { trg: this.id, type: this.vars.type, transfer_type: "push", action: "update_list", vars: this.vars } );
		}
		
		
		
		
		return this;
	}
}


